package P4;

import java.rmi.RemoteException;

public class Main {

	
	
	
	public static void main(String[] args) {
		String[] sr = {"3012"};
		//StartRegistry startRegistry = new StartRegistry(sr);
		
		//Server s3 = new ServerImpl("localhost:3012", "src/P4/cases/input_test_case_"+testCase+"_server_3.txt");
		
		
		final String testCase = "A";
		
		Thread t3 = new Thread(new Runnable(){
			public void run(){
				
					String[] sr = {"3012"};
					StartRegistry startRegistry = new StartRegistry(sr);
				
			}
		});
		t3.start();
		

		Thread t1 = new Thread(new Runnable(){
			public void run(){
				try {
					Server s1 = new ServerImpl("localhost:3012", "src/P4/cases/input_test_case_"+testCase+"_server_1.txt");
				} catch (RemoteException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
			}
		});
		t1.start();
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		Thread t2 = new Thread(new Runnable(){
			public void run(){
				try {
					Server s1 = new ServerImpl("localhost:3012", "src/P4/cases/input_test_case_"+testCase+"_server_2.txt");
				} catch (RemoteException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
			}
		});
		try {
			t2.sleep(100);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		t2.start();
		
		Thread t4 = new Thread(new Runnable(){
			public void run(){
				try {
					Server s1 = new ServerImpl("localhost:3012", "src/P4/cases/input_test_case_"+testCase+"_server_3.txt");
				} catch (RemoteException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
			}
		});
		try {
			t4.sleep(100);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		t4.start();
		
		Thread t6 = new Thread(new Runnable(){
			public void run(){
				try {
					Server s1 = new ServerImpl("localhost:3012", "src/P4/cases/input_test_case_"+testCase+"_server_4.txt");
				} catch (RemoteException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
			}
		});
		try {
			t6.sleep(100);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		t6.start();
	}
}
